# Copyright 2009 Crisis Response International Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Forms for mercyDMS."""

from django import forms
from google.appengine.ext.db import djangoforms

import models
from common.choices import *

class NewVolunteerForm(djangoforms.ModelForm):
  title = forms.ChoiceField(required=False, label="Title", choices=TITLE_CHOICES)
  fname = forms.CharField(label="First Name*")
  mname = forms.CharField(required=False,label="Middle Initial")
  lname = forms.CharField(label="Last Name*")
  address = forms.CharField(label="Address*")
  city = forms.CharField(label="City*")
  state = forms.ChoiceField(label="State*",choices=STATE_CHOICES)
  zipcode = forms.CharField(label="Zip*")
  email = forms.CharField(label="Email*")
  email2 = forms.CharField(required=False,label="Email 2")
  hphone = forms.CharField(label="Home Phone*")
  wphone = forms.CharField(required=False,label="Work Phone")
  cphone = forms.CharField(required=False,label="Mobile Phone")
  aphone = forms.CharField(required=False,label="Alternate Phone")
  class Meta:
    model = models.Volunteer
    exclude = ['gender', 'occupation', 'employment','affiliation', 'active', 'crinews', 'notification', 
               'current_vol_act','would_receive_info',
               'driver_state', 'driver_class', 'have_passport', 'passport_date', 'out_of_country_avail',
               'receive_info', 'prefset', 'skillset', 'courseset', 'skills_approved',
               'skills_approved_by', 'med_approved', 'med_approved_by', 'spiritual_approved',
               'spiritual_approved_by', 'courses_approved', 'courses_approved_by',
               'deploy_availability', 'created', 'modified', 'user', 'user_id', 'active', 'courseset',
               'emergency_contact']

class VolunteerProfileForm(djangoforms.ModelForm):
  title = forms.ChoiceField(required=False, choices=TITLE_CHOICES)
  fname = forms.CharField(widget=forms.TextInput(attrs={'size':'15'}))
  mname = forms.CharField(widget=forms.TextInput(attrs={'size':'2'}))
  lname = forms.CharField(widget=forms.TextInput(attrs={'size':'20'}))
  state = forms.ChoiceField(choices=STATE_CHOICES)
  gender = forms.ChoiceField(choices=GENDER_CHOICES)
  notification = forms.ChoiceField(choices=PRIOR_NOTIFICATION_CHOICES)
  current_vol_act = forms.CharField(required=False,widget=forms.Textarea(attrs={'cols':'65','rows':'5'}))
  driver_class = forms.ChoiceField(choices=DRIVER_CLASS_CHOICES)
  driver_state = forms.ChoiceField(choices=STATE_CHOICES)
  class Meta:
    model = models.Volunteer
    exclude = ['skills_approved','skills_approved_by', 'med_approved', 'med_approved_by', 'spiritual_approved',
               'spiritual_approved_by', 'courses_approved', 'courses_approved_by', 'have_passport',
               'passport_date', 'out_of_country_avail', 'deploy_availability', 'created', 'modified', 'user', 
               'user_id', 'courseset', 'emergency_contact']


class VolunteerPrefsForm(djangoforms.ModelForm):
  class Meta:
    model = models.PrefSet


class VolunteerSkillsForm(djangoforms.ModelForm):
  skill_carpentry = forms.ChoiceField(label="Carpentry",choices=SKILL_LEVELS)
  skill_maintenance = forms.ChoiceField(label="Maintenance", choices=SKILL_LEVELS)
  skill_clergy = forms.ChoiceField(label="Clergy", choices=SKILL_LEVELS)
  skill_mechanic = forms.ChoiceField(label="Mechanic (Vehicle)", choices=SKILL_LEVELS)
  skill_clerical = forms.ChoiceField(label="Clerical",choices=SKILL_LEVELS)
  skill_mental = forms.ChoiceField(label="Mental Health",choices=SKILL_LEVELS)
  skill_computer = forms.ChoiceField(label="Computer Tech",choices=SKILL_LEVELS)
  skill_nurse = forms.ChoiceField(label="Nurse",choices=SKILL_LEVELS)
  skill_doctor = forms.ChoiceField(label="Doctor",choices=SKILL_LEVELS)
  skill_office = forms.ChoiceField(label="Office Manager",choices=SKILL_LEVELS)
  skill_admin_assist = forms.ChoiceField(label="Admin Assistant",choices=SKILL_LEVELS)
  skill_electrician = forms.ChoiceField(label="Electrician",choices=SKILL_LEVELS)
  skill_photographer = forms.ChoiceField(label="Photographer",choices=SKILL_LEVELS)
  skill_medtech = forms.ChoiceField(label="EMT",choices=SKILL_LEVELS)
  skill_plumber = forms.ChoiceField(label="Plumber",choices=SKILL_LEVELS)
  skill_cooking = forms.ChoiceField(label="Food Services",choices=SKILL_LEVELS)
  skill_security = forms.ChoiceField(label="Security",choices=SKILL_LEVELS)
  skill_forklift = forms.ChoiceField(label="Forklift",choices=SKILL_LEVELS)
  skill_socialserv = forms.ChoiceField(label="Social Work",choices=SKILL_LEVELS)
  skill_HVAC = forms.ChoiceField(label="HVAC",choices=SKILL_LEVELS)
  skill_teacher = forms.ChoiceField(label="Teacher/Trainer",choices=SKILL_LEVELS)
  skill_internet = forms.ChoiceField(label="Internet Design",choices=SKILL_LEVELS)
  skill_programming = forms.ChoiceField(label="Software Developer",choices=SKILL_LEVELS)
  skill_video = forms.ChoiceField(label="Videographer",choices=SKILL_LEVELS)
  skill_journalism = forms.ChoiceField(label="Journalism",choices=SKILL_LEVELS)
  skill_warehouse = forms.ChoiceField(label="Warehouse Management",choices=SKILL_LEVELS)
  skill_radio_cert_level = forms.ChoiceField(label="Amateur Radio",
                                             choices=[
                               ('0', 'None'),
                               ('1', 'Technician'),
                               ('2', 'General'),
                               ('3', 'Advanced'),
                               ('4', 'Extra'),])
  skill_radio_license_yr = forms.CharField(required=False,label="Year First Licensed (HAM)")
  skill_guitar_acoustic = forms.ChoiceField(label="Acoustic Guitar",choices=SKILL_LEVELS)
  skill_guitar_electric = forms.ChoiceField(label="Electric Guitar",choices=SKILL_LEVELS)
  skill_guitar_bass = forms.ChoiceField(label="Bass Guitar",choices=SKILL_LEVELS)
  skill_keyboard = forms.ChoiceField(label="Keyboard",choices=SKILL_LEVELS)
  skill_drums = forms.ChoiceField(label="Drums",choices=SKILL_LEVELS)
  skill_percussion = forms.ChoiceField(label="Percussion",choices=SKILL_LEVELS)
  skill_vocals = forms.ChoiceField(label="Vocals",choices=SKILL_LEVELS)
  skill_minister = forms.ChoiceField(label="Ordained Minister",choices=SKILL_LEVELS)
  skill_chaplain = forms.ChoiceField(label="Ordained Chaplain",choices=SKILL_LEVELS)
  skill_instrument_def = forms.CharField(required=False,label="Other Instrument")
  skill_instrument_level = forms.ChoiceField(label="Proficiency",choices=SKILL_LEVELS)
  skill_worship_ministry_exp = forms.CharField(required=False,label="Ministry / Worship Leading Experience",
    widget=forms.Textarea(attrs={'cols':'75','rows':'5'}))
  skill_license = forms.CharField(required=False,label="Identify Skils / Licensing e.g. EMT, RN, etc",
                                  widget=forms.Textarea(attrs={'cols':'75','rows':'5'}))
  skill_language1 = forms.ChoiceField(label="Language 1",choices=LANGUAGES_SPOKEN_CHOICES)
  skill_lanlevel1 = forms.ChoiceField(label="Proficiency",choices=SKILL_LEVELS)
  skill_language2 = forms.ChoiceField(label="Language 2",choices=LANGUAGES_SPOKEN_CHOICES)
  skill_lanlevel2 = forms.ChoiceField(label="Proficiency",choices=SKILL_LEVELS)
  skill_language3 = forms.ChoiceField(label="Language 3",choices=LANGUAGES_SPOKEN_CHOICES)
  skill_lanlevel3 = forms.ChoiceField(label="Proficiency",choices=SKILL_LEVELS)
  skill_language4 = forms.ChoiceField(label="Language 4",choices=LANGUAGES_SPOKEN_CHOICES)
  skill_lanlevel4 = forms.ChoiceField(label="Proficiency",choices=SKILL_LEVELS)
  skill_lan_other_def1 = forms.CharField(required=False,label="Other Language 1")
  skill_lan_other_level1 = forms.ChoiceField(label="Proficiency",choices=SKILL_LEVELS)
  skill_lan_other_def2 = forms.CharField(required=False,label="Other Language 2")
  skill_lan_other_level2 = forms.ChoiceField(label="Proficiency",choices=SKILL_LEVELS)
  class Meta:
    model = models.SkillSet
